package com.mdnote.structure.search;

import java.util.Arrays;
import java.util.List;

/**
 * @author Rhythm-2019
 * @version 1.0
 * @date 2020/8/28
 * @description 线性查找
 */
public class SeqSearch {

    public static int search(int[] source, int element) {
        for (int i = 0; i < source.length; i++) {
            if (source[i] == element) {
                return i;
            }
        }
        return -1;
    }

    public static void main(String[] args) {
        int[] data = {11, 22, 33, 44, 55};
        System.out.println(search(data, 22));
    }
}
